import React from 'react'
import '../css/newsData.css'

class NewsData extends React.Component {
    constructor() {
        super()
        this.state = {
            news: {}
        }
    }

    componentWillMount() {
        this.state.news = this.props.history.location.state;
        this.setState({
            news: this.state.news
        })
    }

    render() {
        return (
            <div>
                <div className="new_nav">
                    <span className="new_back" onClick={()=> {
                        window.history.back()
                    }}>返回</span>
                    <h2 className="new_item">{this.state.news.title}</h2>
                </div>
                <img src={this.state.news.pic} width="100%" />
            </div>
        )
    }
}

export default NewsData